<?php
@header("Content-type:text/html;charset=GB2312");
defined('BASEPATH') OR exit('No direct script access allowed');

class Comment extends CI_Controller
{
    function index(){
        $my = $this->load->database('default', TRUE);
        $ms = $this->load->database('sqlserver', TRUE);

        $size = 500;
        $page = isset($_GET['page']) ? $_GET['page'] : 1;
        $zongshu = $page * $size;

        $sql = "select top $size * from (select top $zongshu  * from NC_Comment order by CommentID asc) NC_Comment order by CommentID desc";
        $msq = $ms->query($sql)->result_array();
        $m = array();
        foreach($msq as $v){
            $k = array(
                'CommentID'=> $v['CommentID'],
                'ChannelID'=> $v['ChannelID'],
                'postid'=> $v['postid'],
                'content'=> $v['content'],
                'Grade'=> $v['Grade'],
                'username'=> $v['username'],
                'postime'=> $v['postime'],
                'postip'=> $v['postip'],
            );
            $m[] = $k;
        }
        var_dump("<pre>");
        var_dump($m);
    }
}